home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / DATABASE.DIR / 00100_Script_CAPTIONS < prev    next >
Text File  |  1996-03-28  |  3KB  |  85 lines

  1. -- --------------------------------------------------------------
  2. -- Handler prepareCaption creates caption fields.
  3.  
  4. on prepareCaptions firstCast, targetCast
  5.   put the text of cast "captionsList" into captionInfo
  6.   set numLines = the number of lines in captionInfo
  7.   
  8.   repeat with i = 1 to numLines
  9.     set caption = line i of captionInfo
  10.     set nextCast = findEmpty(cast targetCast)
  11.     put caption into cast nextCast
  12.     set nameOld = the name of cast (firstCast + i - 1)
  13.     set numChars = the number of chars in nameOld
  14.     set shortChars = NumChars - 7
  15.     set newName =  char 1 to shortChars of nameOld &  "CAPTION"
  16.     set the name of cast nextCast = newName
  17.   end repeat
  18.   
  19. end
  20.  
  21. -- --------------------------------------------------------------
  22. -- Handler showPictureCaption
  23.  
  24. on showTopicPictureCaption
  25.   global textSprite, clickedTopic
  26.   global captionSprite, captionV, captionH, currentCaption
  27.   
  28.   set captionCast = getCaptionCastNumber(clickedTopic, currentCaption)
  29.   set captionText = the text of cast captionCast
  30.   -- switch cast members instead of copying text over to preserve
  31.   -- the text styles and colors of each field.
  32.   if (captionCast = -1) then -- no caption
  33.     errorAlert("No caption for" && clickedTopic)
  34.     exit
  35.   end if
  36.   
  37.   --  setCaptionAttributes(captionCast)
  38.   -- show the caption
  39.   put captionText into cast the castNum of sprite captionSprite
  40.   --  set the castNum of sprite captionSprite = the number of cast captionCast
  41.   set the locH of sprite captionSprite = captionH
  42.   set the locV of sprite captionSprite = captionV
  43.   setFieldFont(captionCast)
  44. end
  45.  
  46. -- --------------------------------------------------------------
  47. -- Handler removeTopicPictureCaption
  48.  
  49. on removeTopicPictureCaption
  50.   global captionSprite
  51.   
  52.   removeFromStage(captionSprite)
  53. end
  54.  
  55. -- --------------------------------------------------------------
  56. -- Handler resetCurrentCaption resets the global variable currentCaption
  57. -- to 1. This global variable is used to indicate the caption number
  58. -- of the currently displayed topic (to know what caption
  59. -- number the previous and next captions are for moreUp and moreDown).
  60.  
  61. on resetCurrentCaption
  62.   global currentCaption
  63.   
  64.   set currentCaption = 1
  65. end
  66.  
  67. -- --------------------------------------------------------------
  68. -- Handler updateCurrentCaption sets the global variable currentCaption
  69. -- to the next caption in the given direction.
  70.  
  71. on updateCurrentCaption direction
  72.   global currentCaption
  73.   
  74.   set currentCaption = currentCaption + direction
  75. end
  76.  
  77. -- --------------------------------------------------------------
  78. -- Handler setCurrentCaption sets the global variable currentCaption
  79. -- to the caption number of the current topic caption.
  80.  
  81. on setCurrentCaption -- called from ???
  82.   global currentCaption, captionSprite
  83.   
  84.   set currentCaption = value(the last char of the name of cast the castNum of sprite captionSprite)
  85. end